/**
 * 
 */
package org.manggis.xml;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author ppacka
 *
 */
public class Element {

	private String name;
	private Element parent;
	private List children;	
	private Map attributes;
	private String text;
	
	public Element(String name, Element parent) {
		this.name = name;
		this.parent = parent;
		this.children = new ArrayList();
		this.attributes = new HashMap();
	}

	public String getElementName() {
		return name;
	}

	void addChild(Element child) {
		children.add(child);
	}

	public Element getParent() {
		return parent;
	}

	public List getChildren() {
		return children;
	}

	void putAttribute(String attribute, String value) {
		attributes.put(attribute, value);
	}

	public String getAttribute(String attribute) {
		return (String)attributes.get(attribute);
	}

    void setText(String text) {
    	this.text = text;
	}

	public String getText() {
		return text;
	}

}
